/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ui.gui.documents.actions;

import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;

import ui.gui.actions.OpenFileAction;
import ui.gui.documents.AbstractDocument;
import ui.gui.documents.AltaRicaTree;
import ui.gui.documents.EditorAction;


/**
 *
 * @author stephane
 */
public class ActionRefactorNode extends EditorAction {

    private static final long serialVersionUID = 1L;

    public ActionRefactorNode(AbstractDocument document) {
        super("Refactor > Rename", document);
        putValue(AbstractAction.SMALL_ICON, new javax.swing.ImageIcon(OpenFileAction.class.getResource("/resources/rename.png")));
        putValue(AbstractAction.SHORT_DESCRIPTION, "Rename node with code refactoring");
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        if (getDocument() != null && getDocument() instanceof AltaRicaTree) {
        	AltaRicaTree editor = (AltaRicaTree) getDocument();   
        	editor.refactorRename();
        }
    }
}
